#ifndef RECTANGLE_H_INCLUDED
#define RECTANGLE_H_INCLUDED

#include <iostream>

template <class T>

class Rectangle
{
public:
	T xpos, ypos, width, height;
	Rectangle() : xpos(0), ypos(0), width(0), height(0) {}

	Rectangle(T x, T y, T W, T H) : xpos(x), ypos(y), width(W), height(H)
	{
	}

	T GetArea()
	{
		T Area;
		Area = width * height;
		return Area;
	}

	T Intersect(const Rectangle& Rec2) const
	{
		if (xpos < (Rec2.xpos + Rec2.width) &&
		Rec2.xpos < (xpos + width)		&&
		ypos < (Rec2.ypos + Rec2.height)&&
		Rec2.ypos < (ypos + height))
		{
			//std::cout << "HIT" << std::endl;
			return true;
		}
		else
		{
			//std::cout << "no hit" << std::endl;
			return false;
		}
	}
};

typedef Rectangle<int> Rectanglei;
typedef Rectangle<float> Rectanglef;

#endif